<!DOCTYPE html>
<HTML>
<HEAD><meta name="viewport" content="width=device-width, initial-scale=1">
<Title>LegendBox</Title>
<link type='text/css' rel='Stylesheet' href="maxchartapi.css" />
</HEAD>
<body bgcolor="#FFFFFF" text="#000000" topmargin="0" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0">

<p class="heading0">ChartDirector 7.0 (Java Edition)</p>
<p class="heading1">LegendBox</p>
<hr class="separator">
<div class="content">
The class LegendBox represents legend boxes. It is a subclass of <a href="TextBox.htm">TextBox</a>.<br><br>
Use <a href="BaseChart.addLegend.htm">BaseChart.addLegend</a> or <a href="BaseChart.addLegend2.htm">BaseChart.addLegend2</a> to add legend boxes to charts.<br><br>
By default, ChartDirector will add named data representation to the legend box. For pie charts, named sectors (sectors that have text labels) will be added. For xy charts, named data sets will be added. For polar charts, named layers will be added.<br><br>
You may add custom entries to the legend box by using <a href="LegendBox.addKey.htm">LegendBox.addKey</a> or <a href="LegendBox.addKey2.htm">LegendBox.addKey2</a>.<br><br>
To control the ordering of the legend entries, ChartDirector employs a legend entry priority system. Each entry is given a priority number, and the entries are ordered according to ascending priority (unless reversed by using <a href="LegendBox.setReverse.htm">LegendBox.setReverse</a>).<br><br>
For a <a href="PieChart.htm">PieChart</a>, the legend entry priority of a sector is 10000 x (sector_index + 1). The Nth sector has sector_index (N - 1). That means the ordering of the sectors in the legend box is the same as the data array.<br><br>
For an <a href="XYChart.htm">XYChart</a>, the base legend entry priority for a layer is 10000 x (layer_index + 1). Within a layer, the data set priority is 10 x (data_set_index + 1). For example, the legend entry priority for the 5th dataset in the 3rd layer will be 30050. That means the ordering of the data sets in the legend box follows the order in which the layers are created. For data sets within the same layer, the ordering follows the order in which the data sets are added. The ordering can be modified by using <a href="Layer.setLegendOrder.htm">Layer.setLegendOrder</a>.<br><br>
For an <a href="PolarChart.htm">PolarChart</a>, the legend entry priority of a layer is 10000 x (layer_index + 1). That means the ordering of the layers in the legend box follows the order in which the layers are created.<br><br>
For custom entries added using <a href="LegendBox.addKey2.htm">LegendBox.addKey2</a>, you may control the legend entry priority. That means you may insert custom entries anywhere relative to the automatic entries added by ChartDirector.
<br><br>
<div style="width:100%;box-sizing:border-box;">
<table border="1" cellpadding="5" cellspacing="0" width="100%"> 
<tr>
<th width="19%">Method</th><th width="19%">Inherited</th><th>Description</th>
</tr>
<tr>
<td><a href="LegendBox.addKey.htm">addKey</a></td><td>(Self)</td><td>Adds a custom entry to the legend box.</td></tr><tr><td><a href="LegendBox.addKey2.htm">addKey2</a></td><td>(Self)</td><td>Adds a custom entry to the legend box with a given legend entry priority.</td></tr><tr><td><a href="LegendBox.setCols.htm">setCols</a></td><td>(Self)</td><td>Sets the number of columns in the legend box.</td></tr><tr><td><a href="LegendBox.setReverse.htm">setReverse</a></td><td>(Self)</td><td>Reverses the ordering of the legend entries.</td></tr><tr><td><a href="LegendBox.setText.htm">setText</a></td><td>(Self)</td><td>Sets the template of the legend text.</td></tr><tr><td><a href="LegendBox.setKeySize.htm">setKeySize</a></td><td>(Self)</td><td>Sets the size of the legend icon and its distance from the legend text.</td></tr><tr><td><a href="LegendBox.setKeySpacing.htm">setKeySpacing</a></td><td>(Self)</td><td>Sets the distance between two legend entries.</td></tr><tr><td><a href="LegendBox.setKeyBorder.htm">setKeyBorder</a></td><td>(Self)</td><td>Sets the default border color of the legend icon.</td></tr><tr><td><a href="LegendBox.setLineStyleKey.htm">setLineStyleKey</a></td><td>(Self)</td><td>Determines whether to always use "line style legend keys" or not.</td></tr><tr><td><a href="LegendBox.getImageCoor2.htm">getImageCoor2</a></td><td>(Self)</td><td>Gets the image map coordinates of an legend entry as HTML image map attributes.</td></tr><tr><td><a href="LegendBox.getHTMLImageMap.htm">getHTMLImageMap</a></td><td>(Self)</td><td>Generates an HTML image map for the legend box.</td></tr><tr><td><a href="TextBox.setFontStyle.htm">setFontStyle</a></td><td>TextBox</td><td>Sets the font of the text by specifying the file that contains the font.</td></tr><tr><td><a href="TextBox.setFontSize.htm">setFontSize</a></td><td>TextBox</td><td>Sets the font height and width in points.</td></tr><tr><td><a href="TextBox.setFontAngle.htm">setFontAngle</a></td><td>TextBox</td><td>Sets the rotation angle and layout direction of the text.</td></tr><tr><td><a href="TextBox.setFontColor.htm">setFontColor</a></td><td>TextBox</td><td>Sets the color of the text.</td></tr><tr><td><a href="TextBox.setAlignment.htm">setAlignment</a></td><td>TextBox</td><td>Sets the alignment of the text relative to the container box.</td></tr><tr><td><a href="TextBox.setWidth.htm">setWidth</a></td><td>TextBox</td><td>Sets the width of the text box and wraps text if necessary.</td></tr><tr><td><a href="TextBox.setHeight.htm">setHeight</a></td><td>TextBox</td><td>Sets the height of the text box.</td></tr><tr><td><a href="TextBox.setMaxWidth.htm">setMaxWidth</a></td><td>TextBox</td><td>Sets the maximum width of the text box and wraps text if necessary.</td></tr><tr><td><a href="TextBox.setTruncate.htm">setTruncate</a></td><td>TextBox</td><td>Sets the maximum number of lines in the text box, and truncate the text if it exceeds the line count.</td></tr><tr><td><a href="TextBox.setMargin.htm">setMargin</a></td><td>TextBox</td><td>Sets all margins (left, right, top, and bottom) of the text box to the same value.</td></tr><tr><td><a href="TextBox.setMargin2.htm">setMargin2</a></td><td>TextBox</td><td>Sets the margins of the text box.</td></tr><tr><td><a href="Box.setPos.htm">setPos</a></td><td>Box</td><td>Sets the coordinates of the reference point of the box, which by default is the top-left corner of the box.</td></tr><tr><td><a href="Box.setSize.htm">setSize</a></td><td>Box</td><td>Sets the width and height of the box.</td></tr><tr><td><a href="Box.setBackground.htm">setBackground</a></td><td>Box</td><td>Sets the background color, border color and 3D border effect of the box.</td></tr><tr><td><a href="Box.setRoundedCorners.htm">setRoundedCorners</a></td><td>Box</td><td>Sets the border style to use rounded corners.</td></tr><tr><td><a href="Box.getLeftX.htm">getLeftX</a></td><td>Box</td><td>Gets the left x pixel coordinate of the box.</td></tr><tr><td><a href="Box.getTopY.htm">getTopY</a></td><td>Box</td><td>Gets the top y pixel coordinate of the box.</td></tr><tr><td><a href="Box.getWidth.htm">getWidth</a></td><td>Box</td><td>Gets the width of the box.</td></tr><tr><td><a href="Box.getHeight.htm">getHeight</a></td><td>Box</td><td>Gets the height of the box.</td></tr><tr><td><a href="Box.getImageCoor.htm">getImageCoor</a></td><td>Box</td><td>Gets the image map coordinates of the box as HTML image map attributes.</td></tr><tr><td><a href="Box.setZOrder.htm">setZOrder</a></td><td>Box</td><td>Sets the z-order (drawing order) for custom box objects.</td>
</tr>
</table>
</div>

</div>
<hr class="separator"><div class="copyright">&copy; 2022 Advanced Software Engineering Limited. All rights reserved.</div>
</body>
</HTML>
